package com.lagou.controller;

import com.lagou.service.EmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/email")
public class EmailController {

    @Autowired
    private EmailService emailService;

    /**
     * 发送验证码到邮箱
     *
     * @param email
     * @param code
     * @return
     */
    @RequestMapping("/{email}/{code}")
    public boolean sendEmail(@PathVariable("email") String email,
                             @PathVariable("code") String code) {
        emailService.sendSimpleTextMail(email, "验证码测试", "您的登录验证码为: " + code);
        return true;
    }

}
